/**
 * tinymce插件
 */
function initEditor(id) {
    tinymce.init({
        selector: '#' + id,
        theme: 'modern',
        language: 'zh_CN',
        //配置的上传图片的路由
        upload_image_url: ctx + 'public/file/upload',
        height: 400,
        plugins: [
            'advlist autolink autosave lists link image charmap print preview hr anchor pagebreak',
            'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media',
            'save table textpattern contextmenu directionality emoticons template paste textcolor colorpicker',
            'uploadimage nonbreaking'
        ],
        toolbar: 'cut copy paste undo redo | styleselect charmap | formatselect bold italic underline blockquote | alignleft aligncenter alignright alignjustify ' +
            '| bullist numlist outdent indent | link unlink uploadimage code| print preview media removeformat fullpage | forecolor backcolor emoticons',
        //启用菜单栏并显示如下项 [文件 编辑 插入 格式 表格]
        menubar: 'file edit insert view format table',
        //menubar: false,
        statusbar : false,
        paste_data_images: true,
        convert_urls: false,
        body_class: 'markdown-body',
        codesample_dialog_width: '600',
        codesample_dialog_height: '400',
        block_formats: 'Paragraph=p;标题1=h4;标题2=h5;标题3=h6;',
        codesample_languages: [
            {text: 'HTML/XML', value: 'html'},
            {text: 'JavaScript', value: 'javascript'},
            {text: 'CSS', value: 'css'},
            {text: 'PHP', value: 'php'},
            {text: 'Ruby', value: 'ruby'},
            {text: 'Python', value: 'python'},
            {text: 'Java', value: 'java'},
            {text: 'C', value: 'c'},
            {text: 'C#', value: 'csharp'},
            {text: 'C++', value: 'cpp'}
        ],
        content_css: [
            ctx + 'lib/bootstrap/bootstrap.min.css',
            ctx + 'css/editor.min.css'
        ],
        setup: function(editor) {
            editor.on('change', function(e) {
                tinymce.triggerSave();
            });
        }
        //参考网站 https://www.tinymce.com/
    });
}